/*
 * @Description:
 * @Version: 2.0
 * @Autor: 许国辉
 * @Date: 2023-05-19 07:06:13
 * @LastEditors: 许国辉
 * @LastEditTime: 2023-11-02 15:47:26
 */
import { defHttp } from '/@/utils/http/axios';
import {
  ComprehensiveAirModel,
  ComprehensiveAirParams,
} from '../model/comprehensive/ComprehensiveAirModel';
import {
  ComprehensiveHotelModel,
  ComprehensiveHotelParams,
} from '../model/comprehensive/ComprehensiveHotelModel';
import {
  ComprehensiveTrainModel,
  ComprehensiveTrainParams,
} from '../model/comprehensive/ComprehensiveTrainModel';
import {
  ComprehensiveCarModel,
  ComprehensiveCarParams,
} from '../model/comprehensive/ComprehensiveCarModel';
import { ComprehensiveSubsidyResult } from '../model/comprehensive/ComprehensiveSubsidyModel';
import { EmpExpenses } from '../travelItinerary/model/EmpExpensesModel';
// import { OrderStatisticsAirModel } from './air/OrderStatisticsAirModel';
// import { getNewDate } from '../travelItinerary/getDateAPI';
enum Api {
  getComprehensiveAir = '/comprehensive/getComprehensiveAir',
  getComprehensiveHotel = '/comprehensive/getComprehensiveHotel',
  getComprehensiveTrain = '/comprehensive/getComprehensiveTrain',
  getComprehensiveCar = '/comprehensive/getComprehensiveCar',
  getComprehensiveAll = '/comprehensive/getComprehensiveAll',
  getApplyForReimbursement = '/comprehensive/getApplyForReimbursement',
  getComprehensiveSubsidy = '/comprehensive/getExamineApproveApplyForReimbursement',
}
// 报销
export function getApplyForReimbursement(params: any) {
  return defHttp.post<EmpExpenses>({
    url: Api.getApplyForReimbursement,
    params,
    headers: {
      ignoreCancelToken: true,
    },
  });
}
export function getComprehensiveSubsidy(params: ComprehensiveAllParams) {
  return defHttp.post<ComprehensiveSubsidyResult>({
    url: Api.getComprehensiveSubsidy,
    params,
    headers: {
      ignoreCancelToken: true,
    },
  });
}
export function getComprehensiveAir(params: ComprehensiveAirParams) {
  return defHttp.post<ComprehensiveAirModel>({
    url: Api.getComprehensiveAir,
    params,
    headers: {
      ignoreCancelToken: true,
    },
  });
}

export function getComprehensiveCar(params: ComprehensiveCarParams) {
  return defHttp.post<ComprehensiveCarModel>({
    url: Api.getComprehensiveCar,
    params,
    headers: {
      ignoreCancelToken: true,
    },
  });
}

export function getComprehensiveHotel(params: ComprehensiveHotelParams) {
  // params.bookingWay = 1;
  // if (params.optDateStart === undefined) {
  //   params.optDateStart = getNewDate('before', 1);
  // }
  return defHttp.post<ComprehensiveHotelModel>({
    url: Api.getComprehensiveHotel,
    params,
    headers: {
      ignoreCancelToken: true,
    },
  });
}
export function getComprehensiveTrain(params: ComprehensiveTrainParams) {
  return defHttp.post<ComprehensiveTrainModel>({
    url: Api.getComprehensiveTrain,
    params,
    headers: {
      ignoreCancelToken: true,
    },
  });
}

export function getComprehensiveAll(params: ComprehensiveAllParams) {
  return defHttp.post<ComprehensiveAllModel>({
    url: Api.getComprehensiveAll,
    params,
    headers: {
      ignoreCancelToken: true,
    },
  });
}

export interface ComprehensiveAllModel {
  airRecordList: Array<ComprehensiveAirModel>;
  hotelRecordList: Array<ComprehensiveHotelModel>;
  trainRecordList: Array<ComprehensiveTrainModel>;
  carRecordList: Array<ComprehensiveCarModel>;
}
export interface ComprehensiveAllParams {
  chooseDate: any;
}
